import time
from public.action import *
from public.business import *
from public.testData import *
from public.tools import *

testCase = "DBshop033-点击更新商品索引流程"

# 1.点击“点击更新商品索引”按钮，点击“保存索引设置”
firefox=openBrowser(urlAdmin)
DBshopLoginAdmin(firefox)
DBshopEnterMenu2(firefox,"商品管理","商品索引")
firefox.find_element_by_xpath("(//button)[2]").click()
time.sleep(2)
firefox.switch_to_alert().accept()
time.sleep(2)
firefox.find_element_by_xpath("(//button)[1]").click()
# 断言
str=firefox.find_element_by_xpath("(//label[@style='line-height: 30px;'])[3]").text
l=""
r="个"
str1=reGetString(str,l,r)
if int(str1)==0:
    writeLog("%s 测试通过" % testCase)
else:
    writeLog("%s 测试失败" % testCase)
    getPhoto(firefox)
firefox.quit()